%% Author: kevin.jingqiu
%% Created: May 29, 2009
%% Description: TODO: Add description to p1
-module(p1).

%%
%% Include files
%%

%%
%% Exported Functions
%%
-export([solve/0, solve_ho/0]).

%%
%% API Functions
%%
solve() ->
	p1(lists:seq(0,999), 0).

solve_ho() ->
	lists:sum(lists:filter(fun(X)->((X rem 3 =:= 0) or (X rem 5 =:= 0)) end, lists:seq(0, 999))).

%%
%% Local Functions
%%
p1([H|T],N) when (H rem 3 =:= 0) or (H rem 5 =:= 0) -> p1(T, N+H);
p1([_|T],N) -> p1(T,N);
p1([],N) -> N.



